<?php

namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;
class TypeController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function query() {

        $select = DB::table('film_types')->get();
  
        return view('Admin.Column_management',['lanmu'=>$select]);
    }
    
    public function del($id){
        if(DB::table('film_types')->where('type_id',$id)->delete()){
            return redirect('Admin/Column');
        }else{
            return '删除失败！';
        }
    }

    public function Region_query() {

        $Region = DB::table('areas')->get();
  
        return view('Admin.Region_management',['diqu'=>$Region]);
    }

    public function Region_del($id){
        if(DB::table('areas')->where('area_id',$id)->delete()){
            return redirect('Admin/Region');
        }else{
            return '删除失败!';
        }
    }

     public function ins_Column(Request $C){
        $ins = ['type_name'=>"$C->type_name",'type_id'=>$C->type_id,'type_time'=>time()];
        DB::table('film_types')->insert($ins);
        return back();        
    }


    public function ins_Region(Request $req){
        $ins = ['area_name'=>"$req->ins_name",'area_id'=>$req->ins_id,'area_time'=>time()];
        if(DB::table('areas')->insert($ins)){
            return redirect('Admin/Region');
        }else{
            echo '添加失败';
        }

    }



   



    


}
